package com.sun.j2ee.blueprints.servicelocator;

import java.util.Map;
import java.util.HashMap;
import java.util.Collections;


public abstract aspect SimpleCache {	
	
	private static Map<String,Object> cache = Collections.synchronizedMap(new HashMap<String,Object>());
	
	protected abstract pointcut cachedMethods(String Args);
	
	Object around(String str) : cachedMethods(str) {
		if (!cache.containsKey(str))
		{
			Object object=proceed(str);
			cache.put(str,object);
			return object;
		}
		return cache.get(str);
	};
}
